package com.myproject.service;

import org.springframework.security.core.userdetails.UserDetails;

import com.baomidou.mybatisplus.extension.service.IService;
import com.myproject.entity.User;
import com.myproject.exception.BusinessException;
import org.springframework.data.domain.Page;

public interface UserService extends IService<User> {

	UserDetails loadUserByUsername(String username);

	/**
	 * 用户注册
	 */
	void register(User user) throws BusinessException;

	/**
	 * 用户登录
	 * 
	 * @return JWT令牌
	 */
	String login(String username, String password) throws BusinessException;

	/**
	 * 更新用户信息
	 */
	void updateUser(User user) throws BusinessException;

	/**
	 * 修改密码
	 */
	void changePassword(Long userId, String oldPassword, String newPassword) throws BusinessException;

	void deleteUser(Long userId) throws BusinessException;

	User getUserById(Long userId) throws BusinessException;

	/**
	 * 获取用户分页列表
	 * 
	 * @param page 页码，从0开始
	 * @param size 每页大小
	 * @return 分页用户列表
	 */
	Page<User> getUserList(int page, int size);
}